package cn.brilliantfuture.commentry.entity;

// Generated 2011-11-3 13:34:34 by Hibernate Tools 3.3.0.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Privilege generated by hbm2java
 */
@Entity
@Table(name = "privilege", catalog = "cabinet")
public class Privilege implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer privilegeId;
	private String name;
	private String description;
	private boolean deleted;
	private String privilegeKey;
	private Set<RolePrivilege> rolePrivileges = new HashSet<RolePrivilege>(0);

	public Privilege() {
	}

	public Privilege(String name, boolean deleted) {
		this.name = name;
		this.deleted = deleted;
	}

	public Privilege(String name, String description, boolean deleted,
			String privilegeKey, Set<RolePrivilege> rolePrivileges) {
		this.name = name;
		this.description = description;
		this.deleted = deleted;
		this.privilegeKey = privilegeKey;
		this.rolePrivileges = rolePrivileges;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "privilege_id", unique = true, nullable = false)
	public Integer getPrivilegeId() {
		return this.privilegeId;
	}

	public void setPrivilegeId(Integer privilegeId) {
		this.privilegeId = privilegeId;
	}

	@Column(name = "name", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description", length = 45)
	@Length(max = 45)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "deleted", nullable = false)
	public boolean isDeleted() {
		return this.deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@Column(name = "privilege_key", length = 45)
	@Length(max = 45)
	public String getPrivilegeKey() {
		return this.privilegeKey;
	}

	public void setPrivilegeKey(String privilegeKey) {
		this.privilegeKey = privilegeKey;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "privilege")
	public Set<RolePrivilege> getRolePrivileges() {
		return this.rolePrivileges;
	}

	public void setRolePrivileges(Set<RolePrivilege> rolePrivileges) {
		this.rolePrivileges = rolePrivileges;
	}

}
